﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Tour.BLL;
using Tour.DAL;

public partial class Tourist_ListDetail : System.Web.UI.Page
{
    public string TextId { get; set; }
    public int? TourId { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        GetPropertyFromQueryString();
        if (!IsPostBack)
        {
            //LoadTourType();
            LoadData();
            LoadTourDetail();
            LoadTourTypeName();
        }
    }
    void GetPropertyFromQueryString()
    {
        if (Request["TextId"] != null)
            TextId = Request["TextId"].ToString();
        else
            TextId = "";
    }
    void LoadData()
    {
        //int TotalRow = 0;
        List<TblTourEntity> ls = TblTourManager.CreateInstant().SelectTblTourBy(null,null, TextId, true, true, true, true, "", "");
        rpt.DataSource = ls;
        rpt.DataBind();
        if (ls != null && ls.Count > 0)
        {
            TourId = ls[0].Id;
        }
    }
    void LoadTourDetail()
    {
        //int TotalRow = 0;
        rptTourDetail.DataSource = TblTourDetailManager.CreateInstant().SelectTourDetailBy(null, TourId, "", "");
        rptTourDetail.DataBind();
    }
    void LoadTourTypeName()
    {
        int TotalRow = 0;
        rptTourTypeName.DataSource = TblTourManager.CreateInstant().SelectTblTourBy(null, null, TextId, true, true, true, true, 1, 1, out TotalRow, "", "");
        rptTourTypeName.DataBind();       
    }
}